package com.ruoyi.api;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.merchant.domain.Goods;
import com.ruoyi.merchant.domain.Shop;
import com.ruoyi.merchant.service.IGoodsService;
import com.ruoyi.merchant.service.IShopService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.tags.Tags;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Api(tags = "微信小程序-商户接口", description = "商户信息")
@RestController
@RequestMapping("/wxapi/merchant")
@Slf4j
public class WxMerchantController extends BaseController{

    @Autowired
    private IShopService iShopService;

    @Autowired
    private IGoodsService iGoodsService;

    /**
     * 查询店铺列表
     */
    @ApiOperation("查询店铺列表")
    @GetMapping("/shops")
    public AjaxResult list(Shop shop)
    {
        startPage();
        List<Shop> list = iShopService.selectShopList(shop);
        return AjaxResult.success(getDataTable(list));
    }
    
     /**
     * 店铺商品列表
     */
    @ApiOperation("店铺商品列表")
    @GetMapping("/goods")
    public AjaxResult goods(Goods goods)
    {
        startPage();
        List<Goods> list = iGoodsService.selectGoodsList(goods);
        log.debug("---------> 分页商品"+list);
        return AjaxResult.success(getDataTable(list));
    }
}
